package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;


@RestController
@RequestMapping("/member/orders/project")
public class MNursingProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目列表
     */
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> list(
            String name,
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize,
            Long status) {

        NursingProject nursingProject = new NursingProject();
        nursingProject.setName(name);
        nursingProject.setStatus(status);

        startPage(pageNum, pageSize);
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

    /**
     * 根据编号查询护理项目
     */
    @GetMapping("/{id}")
    public R<NursingProject> getInfo(@PathVariable Long id) {
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }




}
